package com.woniuxy.cq.phrase3.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @description: 返回结果封装
 * @author Daniel
 * @date: 2020/9/3 20:22
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    /**
     * 成功
     */
    private boolean success;

    /**
     * 结果码
     */
    private String code;

    /**
     * 消息
     */
    private String message;

    /**
     * 结果数据
     */
    private Object data;

    public static Result success() {
        return success(null);
    }

    public static Result success(Object data) {

        return new Result(true, "0000", "执行成功", data);
    }

    public static Result fail(String code, String message) {

        return new Result(false, code, message, null);
    }

}
